package com.xing.email.utils;

import java.nio.file.Files;
import java.nio.file.Path;
import java.util.List;


public class EmailTemplate {
    /**
     * 文件路径
     */
    private String path = System.getProperty("user.dir") +
            "\\" + "src\\main\\java\\com\\xing\\email\\utils\\";


    public String generateTemplate(Integer category, String title,
                                   String username, String type, String captcha) {
        String template = "";
        try {
            template = new captcha().content;
            String emailTemplet = template.replace("$(title)", title);
            emailTemplet = emailTemplet.replace("$(userName)", username);
            emailTemplet = emailTemplet.replace("$(type)", type);
            template = emailTemplet.replace("$(captcha)", captcha);
        } catch (Exception e) {

        }

        return template;

    }


    public String getRemindList(List<String> list) {
        StringBuilder listToString = new StringBuilder();
        for (String s : list) {
            String listItem = "<div class=\"list-item\">$(title)</div>";
            String replace = listItem.replace("$(title)", s);
            listToString.append(replace);
        }
        return listToString.toString();
    }
}
